/*
 * @Author: FanWeiHua
 * @Date: 2021-07-29 14:01:33
 * @LastEditTime: 2021-07-30 14:39:01
 * @Description: increment
 */

const state = () => ({
  count: 0,
  theme: 'darkTheme'
});

// getters
const getters = {};

// actions
const actions = {
  add(context) {
    context.commit('add');
  }
};

// mutations
const mutations = {
  add(state) {
    state.count++;
  },
  /**
   * 主题切换
   */
  switchTheme(state) {
    state.theme === 'darkTheme' ? (state.theme = 'lightTheme') : (state.theme = 'darkTheme');
  }
};

export default {
  namespaced: true,
  state,
  getters,
  actions,
  mutations
};
